1. Technical Field
The present invention relates to the perspective projection that is part of the texture mapping function performed at each pixel by a computer graphics system.
2. Description of the Prior Art
Computer graphics systems are frequently used to model a scene having three-dimensional objects and display the scene on a two-dimensional display device such as a cathode ray tube or liquid crystal display. Typically, the three-dimensional objects of the scene are each represented by a multitude of polygons (or primitives) that approximate the shape of the object.
Texture mapping is the mapping of a function onto a three-dimensional surface. The domain of the function may be one, two, or three dimensional. Moreover, the function may be represented by an array or a mathematical function. Some of the parameters that may be texture mapped include:
1) surface color; PA1 2) specular reflection; PA1 3) normal vector perturbation ("bump mapping"); PA1 4) specularity (the glossiness coefficient); PA1 5) transparency; PA1 6) diffuse reflection; and PA1 7) shadows, surface displacement, and mixing coefficients.
Generally, to perform the texture mapping operation, a source image (texture) is mapped onto a surface of a three-dimensional object in object space, which is then mapped to the viewing coordinate system by the viewing projection. Correct treatment of perspective projections while performing texture mapping requires a divide operation at each pixel. A more detailed description of the perspective projection required for texture mapping may be found in P.S. Heckbert, "Survey of Texture Mapping", IEEE Computer Graphics and Applications, November 1986, pp. 56-67, and P.S. Heckbert et al. "Interpolation of Polygon Texture Mapping and Shading", TM 13, NYIT Computer Graphics Lab, April 1983, hereinafter incorporated by reference in their entirety. Conventionally, the divide operation required to perform the perspective projection is accomplished by an exact divide operation, which is very computationally intensive requiring extensive processing time and/or hardware.
EP 0637813A2 discloses a method and apparatus that utilizes a plurality of look-up tables to perform the texture mapping function with perspective projection. More specifically, for each triangular polygon to be rendered, the (x,y) view coordinates, the original z-coordinate, and the corresponding (u,v) texture coordinates of the vertices of the triangular polygon are supplied to a processor 41. The processor 41 determines the pixel positions (x,y) between two vertices and forwards the z-coordinate value of the two vertices to a selector. The selector selects a particular look-up table from a plurality of look-up tables stored in a memory device according to the supplied z-coordinate values. Each look-up table stores a function that represents an interpolated value of the change in the u (or v) texture coordinate as a function of a given pixel position (x,y) and a given z-coordinate. Then, for each pixel, the processor 41 addresses the selected lookup table to provide for a substantially perspective correct mapping of the texture coordinate at the pixel. This method too is inefficient requiring the processing time and circuity to select the appropriate lookup table, and also requires a memory device to hold the plurality of look-up tables.
Another alternative is to subdivide the primitives very finely so that perspective errors become less perceptible. However, this approach has the drawback of increasing the number of primitives to be processed by the raster subsystem, thus increasing the work performed by the raster subsystem.
As a consequence, texture mapping is performed without perspective correction in most lower cost systems. Thus, there is a need for a method and apparatus that provides for texture mapping with perspective correction that is suitable for use in lower cost systems, and that also provides for improved performance of the texture mapping function.